import { getlist } from '@/api/index'
export default {
  state: {
    typelist: [],
    currentId: ''
  },
  mutations: {
    setTypelist (state, value) {
      state.typelist = value
    },

    setCurrentId (state, value) {
      state.currentId = value
    }
  },
  actions: {
    async getTypelist (context) {
      const res = await getlist()
      console.log(res)
      context.commit('setTypelist', res.data.data.channels)
      context.commit('setCurrentId', res.data.data.channels[0].id)

      // 调用详情
      context.dispatch('list/getInfolist', res.data.data.channels[0].id, { root: true })
    }
  },
  getters: {},
  namespaced: true
}
